package com.webservice;


import com.domain.*;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import java.util.List;

@WebService(targetNamespace = "http://39.98.59.6/mmms_test/ws/process")
public interface ProcessWebservice {


    /**
     * 跳转到目标节点
     * 前端无需使用！！！！！！
     * @param order_id
     * @param nodeName
     * @param user_id
     * @return
     */
    @WebResult(name = "int")
    public int skipNode(@WebParam(name = "order_id") Integer order_id,
                        @WebParam(name = "nodeName")String nodeName,
                        @WebParam(name = "user_id") Integer user_id);


    /**
     * 完全删除一单
     * @param order_id
     * @return
     */
    @WebResult(name = "int")
    public int delOrder(@WebParam(name = "order_id")Integer order_id);

    /**
     * 结束一单，在数据库中保留
     * @param order_id
     * @param user_id
     * @return
     */
    @WebResult(name = "int")
    public int stopOrder(@WebParam(name = "order_id")Integer order_id,
                         @WebParam(name = "user_id")Integer user_id,
                         @WebParam(name = "reason")String reason);

    /**
     * 查找一个维修单审批流程中已审批的审批员
     * @param order_id
     * @return
     */
    @WebResult(name = "userList")
    public List<User> findReviewFinished(@WebParam(name = "order_id")Integer order_id);


    /**
     * 查找一个维修单审批流程中未审批的审批员
     * @param order_id
     * @return
     */
    @WebResult(name = "userList")
    public List<User> findReview(@WebParam(name = "order_id")Integer order_id);


    /**
     * 查询维修单上一个任务详情
     * @param order_id
     * @return
     */
    @WebResult(name = "Maintenance_process")
    public Maintenance_process lastTaskName(@WebParam(name = "order_id") Integer order_id);
    /**
     * 根据用户id和维修单状态查询任务数量
     * @param user_id
     * @param order_state
     * @return
     */
    @WebResult(name = "int")
    public int taskNum(@WebParam(name = "user_id") Integer user_id,
                       @WebParam(name = "order_state") Integer order_state);


    /**
     * 根据用户id查询所有任务数量
     * 用于桌面角标
     * @param user_id
     * @return
     */
    @WebResult(name = "int")
    public int allTaskNum(@WebParam(name = "user_id") Integer user_id);

    /**
     * 根据用户id查询可竞单的维修单数量
     * @param user_id
     * @return
     */
    @WebResult(name = "int")
    public int bidNum(@WebParam(name = "user_id") Integer user_id);

    /**
     * 查询任务
     * @param user_id
     * @return
     */
    @WebResult(name = "orderList")
    public List<Maintenance_order> findTask(@WebParam(name = "user_id") Integer user_id);

    /**
     * 设备管理员启动流程
     * order_state：->1
     * 完成后task_id：1
     * @param equipment_admin
     * @param maintenance_order
     * @param flag 1为第一次启动，撤回修改时随意
     * @return
     */
    @WebResult(name = "int")
    public int start(@WebParam(name = "equipment_admin")User equipment_admin,
                     @WebParam(name = "maintenance_order")Maintenance_order maintenance_order,
                     @WebParam(name = "flag") Integer flag,
                     @WebParam(name = "request")String request);

    /**
     * 设备管理员撤销维修单
     * @param order_id
     * @return
     */
    @WebResult(name = "int")
    public int equipmentAdmin_returnTask(@WebParam(name = "order_id")Integer order_id);


    /**
     * 新增方法
     * 审核员选择维修方进行预估报价
     * @param order_id
     * @param approver_id 审核员id
     * @param unit_id 选择的维修方id
     * @param approver_request 维修要求（选填）
     * @param second_price 拟定报价（选填）
     * order_state：1->16
     * 完成后task_id：2
     * @return 0：正常
     *          -1：无此维修单
     *          -2：无审核员或指定维修方
     *          -3：无此流程
     *          -4：操作失败
     *          -5：发送短信失败
     */
    @WebResult(name = "int")
    public int approveToGetEstimate(@WebParam(name = "order_id")Integer order_id,
                                    @WebParam(name = "approver_id")Integer approver_id,
                                    @WebParam(name = "unit_id") Integer unit_id,
                                    @WebParam(name = "approver_request")String approver_request,
                                    @WebParam(name = "second_price")Float second_price);

    /**
     * 新增方法
     * 审核员从维修方报价状态撤回到报修审核
     * @param order_id
     * @param approver_id 审核员id
     * order_state：16->1
     * 完成后task_id：2
     * @return  0：正常
     *          -1：无此维修单
     *          -2：无审核员
     *          -3：无此流程
     *          -4：操作失败
     *          -5：短信发送失败
     */
    @WebResult(name = "int")
    public int EstimateBackToApprover(@WebParam(name = "order_id")Integer order_id,
                                      @WebParam(name = "approver_id")Integer approver_id);

    /**
     * 新增方法
     * 维修方给出预估报价
     * @param order_id
     * @param estimate_price 预估报价
     * @param expense_details 预估材料清单
     * @return 0：正常
     *        -1：无此维修单
     *        -2：无预估价格或价格小于0
     *        -3：无此流程
     *        -4：操作失败
     *        -5：短信发送失败
     * order_state：16->1
     * 完成后task_id：15
     */
    @WebResult(name = "int")
    public int EstimateToApprover(@WebParam(name = "order_id")Integer order_id,
                                  @WebParam(name = "estimate_price")Float estimate_price,
                                  @WebParam(name = "expense_details") String expense_details);


    /**
     * 审核员选择审批员
     * @param order_id 维修单id
     * @param approver_id 当前审核员
     * @param reviewers 审批员列表，格式为：1,2,3,
     * order_state：1->4
     * 完成后task_id：2
     * @return
     */
    @WebResult(name = "int")
    public int maintenance_review(@WebParam(name = "order_id")Integer order_id,
                                  @WebParam(name = "approver_id")Integer approver_id,
                                  @WebParam(name = "reviewers")String reviewers,
                                  @WebParam(name = "approver_request")String approver_request,
                                  @WebParam(name = "second_price")Float second_price);


    /**
     * 审核员撤回审批申请
     * @param order_id
     * @param flag 1为撤回到报修审核，2为撤回到审核员选择是否维修，3为撤回到验收审核，4为撤回到正在竞单
     * @return
     */
    @WebResult(name = "int")
    public int approver_returnTask(@WebParam(name = "order_id")Integer order_id,
                                   @WebParam(name = "approver_id")Integer approver_id,
                                   @WebParam(name = "flag")Integer flag);


    /**
     * 审核员撤回竞单或者指派
     * @param order_id
     * @param approver_id
     * @return
     */
    @WebResult(name = "int")
    public int approver_returnUnit(@WebParam(name = "order_id")Integer order_id,
                                   @WebParam(name = "approver_id")Integer approver_id);


    /**
     * 审批员进行报修审批
     * @param order_id
     * @param reviewer_id
     * @param review_request 维修要求，驳回时为空字符串
     * @param reason 驳回理由，通过时为空字符串
     * order_state：4->1
     * 完成后task_id：4
     * @return
     */
    @WebResult(name = "int")
    public int first_review(@WebParam(name = "order_id")Integer order_id,
                            @WebParam(name = "reviewer_id")Integer reviewer_id,
                            @WebParam(name = "review_request")String review_request,
                            @WebParam(name = "reason")String reason);

    /**
     * 修改方法
     * 审核员审核选择竞单
     * order_state：1->2
     * 完成后task_id：2
     * @param order_id
     * @return
     */
    @WebResult(name = "int")
    public int approveOrder_Bid(@WebParam(name = "order_id")Integer order_id,
                                @WebParam(name = "user_id")Integer user_id,
                                @WebParam(name = "biddingPeriodOfValidity") Integer biddingPeriodOfValidity,
                                @WebParam(name = "approver_request")String approver_request,
                                @WebParam(name = "second_price")Float second_price,
                                @WebParam(name = "unit") String unit);

    /**
     * 审核员审核选择指派
     * order_state：1->14
     * 完成后task_id：2
     * @param order_id 维修单id
     * @param unit_id 维修方id
     * @param user_id 审核员id
     * @return
     */
    @WebResult(name = "int")
    public int approveOrder_Repair(@WebParam(name = "order_id")Integer order_id,
                                   @WebParam(name = "unit_id")Integer unit_id,
                                   @WebParam(name = "user_id")Integer user_id,
                                   @WebParam(name = "approver_request")String approver_request,
                                   @WebParam(name = "second_price")Float second_price);


    /**
     * 重新选择维修方
     * @param order_id
     * @param unit_id
     * @param user_id
     * @param reason
     * @return
     */
    @WebResult(name = "int")
    public int updateUnit(@WebParam(name = "order_id")Integer order_id,
                          @WebParam(name = "unit_id")Integer unit_id,
                          @WebParam(name = "user_id")Integer user_id,
                          @WebParam(name = "reason")String reason);

    /**
     * 审核员审核选择驳回
     * order_state：1->11
     * 完成后task_id：2
     * @param order_id
     * @param reason
     * @return
     */
    @WebResult(name = "int")
    public int approveOrder_Refuse(@WebParam(name = "order_id")Integer order_id,
                                   @WebParam(name = "reason")String reason,
                                   @WebParam(name = "user_id")Integer user_id);

    /**
     * 竞单后选择公司并选择审批员
     * order_state：
     *              选择审批员：2->12
     *              完成后task_id：3
     * @param order_id
     * @param unit_id 维修方id
     * @param reviewer_id 审批员id，格式为：1,2,3,
     * @param approver_id 新增  审核员id
     * @return
     */
    @WebResult(name = "int")
    public int choose_Company(@WebParam(name = "order_id")Integer order_id,
                              @WebParam(name = "unit_id")Integer unit_id,
                              @WebParam(name = "reviewer_id") String reviewer_id,
                              @WebParam(name = "approver_id") Integer approver_id);



    /**
     * 竞单后放弃维修
     * order_state：2->11
     * 完成后task_id：3
     * @param order_id
     * @param reason
     * @param approver_id  新增  审核员id
     * @return
     */
    @WebResult(name = "int")
    public int choose_Refuse(@WebParam(name = "order_id")Integer order_id,
                             @WebParam(name = "reason")String reason,
                             @WebParam(name = "approver_id") Integer approver_id);



    /**
     * 审批员选择修
     * order_state：12->13
     * 完成后task_id：11
     * @param order_id
     * @param reason 通过为空字符串
     * @return
     */
    @WebResult(name = "int")
    public int review_Pass(@WebParam(name = "order_id")Integer order_id,
                           @WebParam(name = "reviewer_id")Integer reviewer_id,
                           @WebParam(name = "reason")String reason);

    /**
     * 审核员选择审批员
     * @param order_id 维修单id
     * @param approver_id 当前审核员
     * @param reviewers 审批员列表，格式为：1,2,3,
     * order_state：13->12
     * 完成后task_id：13
     * @return
     */
    @WebResult(name = "int")
    public int approver_review(@WebParam(name = "order_id")Integer order_id,
                               @WebParam(name = "approver_id")Integer approver_id,
                               @WebParam(name = "reviewers")String reviewers);

    /**
     * 审核员选择重新选择维修公司
     * @param order_id 维修单id
     * @param approver_id 当前审核员
     * order_state：13->2
     *  完成后task_id：13
     * @return
     */
    @WebResult(name = "int")
    public int approver_turnBid(@WebParam(name = "order_id")Integer order_id,
                               @WebParam(name = "approver_id")Integer approver_id);


    /**
     * 审核员确定进行维修
     * @param order_id
     * @param approver_id
     * order_state：13->14
     * 完成后task_id：13
     * @return
     */
    @WebResult(name = "int")
    public int makeSureUnit(@WebParam(name = "order_id")Integer order_id,
                            @WebParam(name = "approver_id")Integer approver_id);


    /**
     * 审批过后，审核员放弃维修
     * @param order_id
     * @param approver_id
     * @param reason
     * order_state：13->11
     * 完成后task_id：13
     * @return
     */
    @WebResult(name = "int")
    public int giveUp(@WebParam(name = "order_id")Integer order_id,
                      @WebParam(name = "approver_id")Integer approver_id,
                      @WebParam(name = "reason")String reason);


    /**
     * 维修方接受维修
     * order_state：14->3
     * 完成后task_id：12
     * @param order_id
     * @return
     */
    @WebResult(name = "int")
    public int maintenanceAcceptDecision(@WebParam(name = "order_id")Integer order_id);


    /**
     * 维修方不接受维修
     * order_state：14->1
     * 完成后task_id：12
     * @param order_id
     * @return
     */
    @WebResult(name = "int")
    public int maintenanceRefuseDecision(@WebParam(name = "order_id")Integer order_id,
                                         @WebParam(name = "reason")String reason);


    /**
     * 维修单位维修完成上传维修情况
     * order_state：3->5
     * 完成后task_id：5
     * @param order_id
     * @param solution_word_description
     * @param solution_image_description
     * @param solution_video_description
     * @param expense_detailsList
     * @return
     */
    @WebResult(name = "int")
    public int maintenance_Finished(@WebParam(name = "order_id")Integer order_id,
                                    @WebParam(name = "final_price")Float final_price,
                                    @WebParam(name = "warranty_period")Integer warranty_period,
                                    @WebParam(name = "solution_word_description")String solution_word_description,
                                    @WebParam(name = "solution_image_description")String solution_image_description,
                                    @WebParam(name = "solution_video_description")String solution_video_description,
                                    @WebParam(name = "expense_detailsList")String expense_detailsList);


    /**
     * 维修反馈时添加清单文件
     * @param order_id
     * @param fileName
     * @return
     */
    @WebResult(name = "int")
    public int uploadExpenseFile(@WebParam(name = "order_id")Integer order_id,
                                 @WebParam(name = "fileName")String fileName);


    /**
     * 维修方上传维修情况后撤回
     * order_state：5->3
     * 完成后task_id：5
     * @param order_id
     * @return
     */
    @WebResult(name = "int")
    public int maintenance_turnBack(@WebParam(name = "order_id")Integer order_id);


    /**
     * 维修单位修不好并说出理由
     * order_state：3->8
     * 完成后task_id：5
     * @param order_id
     * @param reason
     * @return
     */
    @WebResult(name = "int")
    public int maintenance_Fault(@WebParam(name = "order_id") Integer order_id,
                                 @WebParam(name = "reason") String reason);

    /**
     * 设备管理员确认通过
     * order_state：5->6
     * 完成后task_id：6
     * @param order_id
     * @return
     */
    @WebResult(name = "int")
    public int equipment_admin_Pass(@WebParam(name = "order_id")Integer order_id);

    /**
     * 设备管理员不通过并给出理由
     * order_state：5->3
     * 完成后task_id：6
     * @param order_id
     * @param reason
     * @return
     */
    @WebResult(name = "int")
    public int equipment_admin_Refuse(@WebParam(name = "order_id")Integer order_id,
                                      @WebParam(name = "reason")String reason);

    /**
     * 审核员确认通过并选择审批员
     * order_state：有审批员：6->7
     *              无审批员：6->8
     * 完成后task_id：7
     * @param order_id
     * @param reviewer_id 格式：1,2,3,
     *                    为空字符串时无审批员
     * @param approver_id 审核员id
     * @return
     */
    @WebResult(name = "int")
    public int approver_Pass(@WebParam(name = "order_id")Integer order_id,
                             @WebParam(name = "reviewer_id")String reviewer_id,
                             @WebParam(name = "approver_id")Integer approver_id);




    /**
     * 审核员不通过并给出理由
     * order_state：6->3
     * 完成后task_id：7
     * @param order_id
     * @param reason
     * @param approver_id 审核员id
     * @return
     */
    @WebResult(name = "int")
    public int approver_Refuse(@WebParam(name = "order_id")Integer order_id,
                               @WebParam(name = "reason")String reason,
                               @WebParam(name = "approver_id")Integer approver_id);


    /**
     * 审批员审批
     * order_state：7->6
     * 完成后task_id：8
     * @param order_id
     * @param reason  通过时为空字符串
     * @return
     */
    @WebResult(name = "int")
    public int reviewer_Refuse(@WebParam(name = "order_id")Integer order_id,
                               @WebParam(name = "reviewer_id")Integer reviewer_id,
                               @WebParam(name = "reason")String reason);

    /**
     * 设备管理员评价
     * order_state：8->9
     * 完成后task_id：9
     * @param order_id
     * @param maintenance_time
     * @param maintenance_qualification
     * @param maintenance_attitude
     * @param detail
     * @return
     */
    @WebResult(name = "int")
    public int evaluation(@WebParam(name = "order_id")Integer order_id,
                          @WebParam(name = "maintenance_time")String maintenance_time,
                          @WebParam(name = "maintenance_qualification")String maintenance_qualification,
                          @WebParam(name = "maintenance_attitude")String maintenance_attitude,
                          @WebParam(name = "detail")String detail);


    /**
     * 修改方法
     * 查询所有能够追评的维修单
     * @return
     */
    @WebResult(name = "orderList")
    public List<Maintenance_order> findAdditionalEvaluationOrder(@WebParam(name = "equipment_admin_id")Integer equipment_admin_id);

    /**
     * 设备管理员追评
     * order_state：9->9
     * 完成后task_id：10
     * @param order_id
     * @param additional_evaluation
     * @return
     */
    @WebResult(name = "int")
    public int additionalEvaluation(@WebParam(name = "order_id")Integer order_id,
                                    @WebParam(name = "additional_evaluation")String additional_evaluation);

    /**
     * 结束
     * order_state：9->10
     * @param order_id
     * @return
     */
    @WebResult(name = "int")
    public int stop(@WebParam(name = "order_id")Integer order_id);




}
